package Controller;

import Pojo.Student;
import Service.ServiceImpl.StudentServiceImpl;
import Service.StudentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @auther wsy
 * @auther MI
 * @create Servlet_Jdbc_Maven.${PACKAGE_NAME}
 * @create 7:39
 * @create 2021/7/6 星期二
 */
@WebServlet("/findAll")
public class FindALLUser extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        StudentService studentService = new StudentServiceImpl();
        List<Student> list = studentService.findAllUser();
        request.setAttribute("list",list);
        request.getRequestDispatcher("/admin/user.jsp").forward(request, response);
    }
}
